import http from "@/api";

/**
 * 角色权限列表
 */
export const authListApi = (id: number) => {
    return http.get(`/role/auths/${id}`);
};

/**
 * 角色列表
 */
export const roleListApi = (params: object) => {
    return http.get(`/role/list`, params);
};

/**
 * 角色分页列表
 */
export const rolePageListApi = (params: object) => {
    return http.get(`/role/paging`, params);
};

/**
 * 新增角色
 * @param params
 */
export const addRoleApi = (params: object) => {
    return http.post(`/role/add`, params);
};

/**
 * 编辑角色
 * @param params
 */
export const editRoleApi = (params: any) => {
    return http.put(`/role/edit/${params.id}`, params);
};

/**
 * 切换角色状态
 * @param id
 */
export const changeStatusApi = (id: number) => {
    return http.put(`/role/change_status/${id}`);
};

/**
 * 修改排序
 * @param params
 */
export const changeSortApi = (params: object) => {
    return http.post(`/role/changeSort`, params);
};

/**
 * 角色授权
 * @param params
 */
export const roleAuthorizationApi = (params: object) => {
    return http.post(`/role/authorization`, params);
};

/**
 * 删除角色
 * @param id
 */
export const deleteRoleByIdApi = (id: number) => {
    return http.delete(`/role/delete/${id}`);
};

/**
 * 批量删除
 * @param params
 */
export const deleteRoleApi = (params: object) => {
    return http.post(`/role/delete`, params);
};
